home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
TURB_VIS
/
TVMENU2
/
READ.ME
< prev
Wrap
Text File
|
1992-07-20
|
3KB
|
65 lines
On joining Compuserve, I looked at the ideas available for adapting Turbo
Vision and was interested to see Danny Thorpe's TVMENU files. After giving
this implementation a go, I felt that using three commands to Mark, Set and
Clear the tick mark was a bit cumbersome. I also perferred the way Windows
tackles the problem.
This implementation, then, is more akin to the Windows approach of being
able to place or remove a check mark from alongside the text of a menu item
by calling a function. These functions are contained in MENUTICK.PAS.
Implementation
--------------
Ideally, it would have been possible to override TMenuItem to add an
additional check mark field. However, for some reason, the innards of the TV
menuing system make use of linked lists of records instead of objects, making
it difficult to override the functionality of the menu system without
replacing key aspects of it.
Instead, an additional menu function (NewCheckItem) has been fashioned to
automatically make space at the beginning of the menu item's NAME for some
kind of mark. If the CHECKED parameter of this function is true, the menu
item is pre-set as being checked. The default check mark is '√' (Ascii 251)
and the default clear mark is a space. Both of these can be changed by
changing the global constants CHECKMARK and CLEARMARK defined in unit
MENUTICK.
MENUTICK also defines four functions able to manipulate this checked state
of a menu item. These are:
CheckMenuItem - Puts the check mark into the Name field of the menu
item and returning True if it could. If False is
returned, the most likely causes are that the menu
item is already checked or that a menu item with
a the given command (see below) does not exist.
ClearMenuItem - The exact opposite of the above.
MenuItemIsChecked - Returns true if a menu item with the given command
constant exists and is checked. If it does exist but
is not checked false will be returned. It a menu
item with the given command constant does not exist
or is disabled, the function will return False and
set the Command parameter to zero.
ToggleMenuItem - This function just flips the clear/checked set
in the specified menu and returns the previous
state as a boolean.
Each of the functions takes two paramters:
AMenu : PMenuItem - Usually this will be the Menu field of the global
variable MenuBar that is defined in TV unit APP.
Command : Word; - The cmXXX constant associated with a menu item.
If you find it useful, please make free (or commercial) use of it.
Acknowledgements:
MENUTICK.PAS continues to use Danny Thorpe's function that locates a
specific menu option. This has been renamed FindMenuItem.
Bill Seddon 20th July 1992
Compuserve 100111,557